package com.xp.ai.rest;

import dev.langchain4j.model.chat.ChatLanguageModel;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OpenAiRest {

    //这里直接就是注入引用 不需要在去new 模型了
    @Resource
    private ChatLanguageModel chatLanguageModel;
    @GetMapping("/openai/test")
    public String testChat(){
        String chat = chatLanguageModel.chat("你是谁？");
        return chat;
    }
}
